<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:composite="http://java.sun.com/jsf/composite">

   	<composite:interface>
      <composite:attribute name="renderEdit" default="true" />
      <composite:attribute name="renderRemove" default="true" />
      <composite:attribute name="renderSelect" default="false" />
      <composite:attribute name="enableSearch" default="false" />
      
      <composite:attribute name="value" type="br.com.center.loja.model.Client" />
      
      <composite:attribute name="searchType" default="ALWAYS_SHOW" />
      
      <composite:attribute name="widthActionColumn" default="170px" />
   	</composite:interface>
            	
	<composite:implementation>
		<p:dataTable var="stored" value="#{client.elements}" paginator="true" rows="20" id="clientList">
			<f:facet name="header">
            	<p:outputPanel rendered="#{cc.attrs.enableSearch}" layout="block" style="float: right;">
               	<h:outputLabel value="#{msg['client.list.label.search']}" />
               	<p:spacer width="10" />
               	<p:inputText id="input" value="#{client.filter}" />
               	<p:spacer width="10" />
               	<p:commandButton id="btnSearch"
                  icon="ui-icon-search"
                  process="input"
                  update="#{cc.clientId}"
                  value="#{msg['crud.search']}" />
            	</p:outputPanel>  		
			</f:facet>
         	<p:column headerText="#{msg['crud.column.action']}" style="width: 170px;">            
         		<h:link outcome="client.jsf" style="padding: 4px 12px;" 
         		class="grid-link ui-button ui-widget ui-state-default ui-corner-all ui-button-text-icon-left" 
            	value="#{msg['crud.edit']}">
            		<f:param name="client" value="#{stored.code}" />
         		</h:link>               	      
            	<p:commandButton id="remove" 
                  icon="ui-icon-pencil"
                  value="#{msg['crud.delete']}" 
                  rendered="#{cc.attrs.renderRemove}"/> 
            	<p:commandButton id="select" 
               	value="#{msg['crud.select']}" 
               	onclick="dlgSearchClient.close();"
               	rendered="#{cc.attrs.renderSelect}">
               	<f:setPropertyActionListener target="#{cc.attrs.value}" 
                     value="#{stored}" />   
             </p:commandButton>
         </p:column>
         
         <p:column 
            headerText="#{msg['client.register.label.code']}">
            <h:outputText value="#{stored.code}" />
         </p:column>

         <p:column 
            headerText="#{msg['client.register.label.name']}">
            <h:outputText value="#{stored.name}" />
         </p:column>

         <p:column 
            headerText="#{msg['client.register.label.email']}">
            <h:outputText value="#{stored.email}" />
         </p:column>         					
		</p:dataTable>
	</composite:implementation>
</html>

